package com.sinosoft.vaccinetoai.server.business.h3cai.workflowchat.controller;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sinosoft.vaccinetoai.server.business.h3cai.workflowchat.io.WorkflowChatIO;
import com.sinosoft.vaccinetoai.server.business.h3cai.workflowchat.vo.WorkflowChatVO;
import com.sinosoft.vaccinetoai.server.business.h3cai.workflowchat.service.IWorkflowChatService;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;
import reactor.core.publisher.Flux;

/**
 * @ClassName: WorkflowChatController
 * @ClassNameExplain: 
 * @Description: 工作流聊天接口接口
 * @author xzh
 * @date 2025年06月24日 15:33
 */
@RestController("WorkflowChatController")
@RequestMapping("/workflow")
public class WorkflowChatController {
	
	@Autowired
	@Qualifier("WorkflowChatService")
	IWorkflowChatService workflowChatService;
	
	/**
	 * @Title: workflowChat
	 * @TitleExplain: 
	 * @Description: 工作流聊天接口接口方法
	 * !!! SSE流式处理放行了http的统一返回封装 需要查看SSEConstants.HTTP_RESPONSE_NO_FILTER进行放行
	 * @param workflowChatIO 入参
	 * @return WorkflowChatVO 返参
	 * @version 1.0.3
	 * @author xzh
	 */
	@PostMapping(value = "/chat",produces = { MediaType.TEXT_EVENT_STREAM_VALUE })
	public Flux<String> workflowChat(@Valid @RequestBody WorkflowChatIO workflowChatIO) throws Exception {
		return workflowChatService.workflowChat(workflowChatIO);
	}
	
}
